private void moveMap(LatLng place) {
CameraPosition cameraPosition =
new CameraPosition.Builder()
.target(place)
.zoom(17)
.build();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
private synchronized void configGoogleApiClient() {
googleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
private void configLocationRequest() {
locationRequest = new LocationRequest();
locationRequest.setInterval(1000);
locationRequest.setFastestInterval(1000);
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}
-// 建立Location請求物件
-// 設定讀取位置資訊的間隔時間為一秒(1000ms)
-// 設定讀取位置資訊最快的間隔時間為一秒(1000ms)
-// 設定優先讀取高精確度的位置資訊(GPS)
private void addMarker(LatLng place, String title, String context) {
// BitmapDescriptor icon =
// BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(place)
.title(title)
.snippet(context)
.icon(bitmapDescriptorFromVector(MapsActivity.this, R.drawable.ugly));
itemMarker = mMap.addMarker(markerOptions);
}